﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BookExchange.ODataService;

namespace BookExchange.Business
{
    public class CategoryBusiness : BaseBusiness<Category>
    {       
        public List<string> GetCategoryDescription()
        {
            var query = DB.Categories
                        .OrderBy(c => c.Description);

            return query.ToList().Select(c => c.Description).ToList();

        }

        public List<Category> GetCategoryList()
        {
            return DB.Categories.ToList();
        }

        public override void Insert(Category obj)
        {
            DB.AddToCategories(obj);
            DB.SaveChanges();
        }
    }
}